/*
 *  mihf.h
 *  MIHF
 *
 *  Created by injae song on 11. 3. 4..
 *  Copyright 2011 KyungHee Univ. All rights reserved.
 *
 */


#ifndef MIH_H
#define MIH_H
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <event.h>
#include <sys/types.h> 
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdarg.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <errno.h>
#include <event.h>
#include <string.h>
#include "list.h"
#include "debug.h"

#define DEST_IP   "127.0.0.1"
#define DEST_PORT 3285
#define MIHF_ID "noxqeust@khu.ac.kr"

typedef struct _mihf {
	
	struct event ev_accept_user;//Event Stucture : for MIH_USER, MIH_NET_TCP, MIH_NET_UDP
	
	struct event ev_accept_net_tcp_peer;//struct event ev_accept_net_tcp_peer;
	
	struct event ev_accept_net_udp_peer;//struct event ev_accept_net_udp_peer;
    
    unsigned long supported_cmds; // 32
	unsigned long supported_events; // 32bits
	unsigned long long supported_isqueries; // 64bits
	
    
    
	char* mih_id; //MIH_ID
	
	List Peer_table; //peer table
	
	List User_table;
	
	List PendingTransaction_table;
    
    List Connect_table;
	
	List Event_Service;
    
}mihf;




void users_free(void *data); //for MIH User List Destroy Function

void peers_free(void *data); //for MIH Peer List Destroy Function

void mihf_init(mihf* mih, char* id ); //for MIH Initialization

void mih_daemon();

#endif